function [Iterations, Losses] = getLossesFromLogFile(logFile)

cnt = 0;
Iterations = zeros(1, 60);
Losses = Iterations;

fid = fopen(logFile);
tline = fgetl(fid);
while ischar(tline)
    [k1, k2] = regexp(tline, 'Iteration\s+\d+,\s+loss\s+=\s+\d+.\d+');
    if isempty(k1)
        tline = fgetl(fid); continue;
    end
    
    s = tline(k1 : k2);
    nums = sscanf(s, 'Iteration %d, loss = %f');
    cnt = cnt + 1;
    fprintf('%d/60\n', cnt);
    Iterations(cnt) = nums(1);
    Losses(cnt) = nums(2);
    
    tline = fgetl(fid);
end

fclose(fid);

% [~, i2] = regexp(s2, 'Iteration\s+');
% [k1, k2] = regexp(s2, 'loss\s+=\s+');
% Iteration = eval(s2(i2+1 : k1-1));
% loss = eval(s2(k2+1 : end));